const fs = require('fs');
const path = require('path');

module.exports = {
  createFolder: (folderPath) => {
    if (!fs.existsSync(folderPath)) {
      fs.mkdirSync(folderPath, { recursive: true });
      console.log(`✅ 创建目录：${folderPath}`);
    }
  },

  saveDocument: (folderPath, fileName, buffer) => {
    const filePath = path.join(folderPath, `${fileName}.docx`);
    fs.writeFileSync(filePath, buffer);
    console.log(`📄 生成文档：${filePath}`);
  }
};